package com.rtmart.springcloudalibaba.product.controller;

import com.rtmart.springcloudalibaba.common.domain.Product;
import com.rtmart.springcloudalibaba.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping("/product/{id}")
    public Product findById(@PathVariable Long id){
        log.info("接收到的id{}", id);
        return productService.findOneById(id);
    }
}
